/* -----------------------------------------------------------------------
 * Name:   Krishan Kodali
 * Course: CS 362
 * Date:   01/26/14
 * unittest2.c is to test isGameOver() funtion in dominion.c
 * -----------------------------------------------------------------------
 */

#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>

void isGameOver_when_provinces_empty(struct gameState *p)
  {
    int return_val;
    p -> supplyCount[province] = 0;
    return_val = isGameOver(p);
    assert(return_val == 1);
}

void isGameOver_three_supply_pile_empty(struct gameState *p) {
    int return_val;
    p -> supplyCount[adventurer] = 0;
    p -> supplyCount[feast] = 0;
    p -> supplyCount[great_hall] = 0;
    return_val = isGameOver(p);
    assert(return_val == 1);
}

int main () {

  int numPlayer = 2;
  int k[10] = {adventurer, council_room, feast, gardens, mine,
	       remodel, smithy, village, baron, great_hall};
  int seed = 1000;
  struct gameState G;
  initializeGame(numPlayer, k, seed, &G);
  printf ("TESTING isGameOver \n");
  printf ("===================\n");
  printf ("Game is Over, if stack of Province cards is empty\n");
  isGameOver_when_provinces_empty(&G);
  printf ("Game is Over, if three supply pile are at 0 \n");
  isGameOver_three_supply_pile_empty(&G);
  printf ("ALL TESTS OK\n\n");

  return 0;
}
